<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.mytrip.util.PageInfo" import="com.mytrip.model.OrderFlight" import="java.util.*" import="java.text.SimpleDateFormat" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>出发吧</title>
<jsp:include page="/common/include_js.jsp" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/front/css/css.css" />
</head>
<body>
<div id="wrap">
   <jsp:include page="include/top.jsp">
  	<jsp:param name="t" value="5" />
  </jsp:include>
  <div id="main">
    <jsp:include page="include/myDetail-left.jsp">
  		<jsp:param name="t" value="2" />
  	</jsp:include>
    <div class="fRt rightBar">
    <div class="breadcrumb">您现在的位置：<a href="">出发吧</a> > <a href="">个人中心</a>> 我的机票</div>
    <div class="title">
        <div class="tlText">我的机票</div>
      </div>
      <div class="stdHPad dubVMrgT">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr style="border-bottom:1px solid #DDD;">
          	<td style="width:100px;font-weight:bold;">航空公司/航班</td>
          	<td style="width:140px;font-weight:bold;">起始机场</td>
          	<td style="width:80px;font-weight:bold;">起降时间</td>
          	<td style="width:80px;font-weight:bold;">总费用</td>
          	<td style="width:100px;font-weight:bold;">乘机人</td>
          	<td style="width:100px;font-weight:bold;">pnr编码</td>
          	<td style="width:100px;font-weight:bold;">下单时间</td>
          	<td style="width:100px;font-weight:bold;">订单状态</td>
          </tr>
          <%
        	PageInfo<OrderFlight> pageInfo = (PageInfo<OrderFlight>)request.getAttribute("orderFlightPage");
        	List<OrderFlight> dataList = pageInfo.getDataList();
        	
        	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        	for(OrderFlight orderFlight : dataList){
        		String flightTime = sdf.format(orderFlight.getFlightTime());
        		String arriveTime = sdf.format(orderFlight.getArriveTime());
        		String cr = (flightTime.split(" ")[0].equals(arriveTime.split(" ")[0]))?"":"(次日)";
        		String airlineCn = orderFlight.getAirlineCn();
        		String flightNo = orderFlight.getAirline()+orderFlight.getFlightNumber();
        		String orderTime = sdf.format(orderFlight.getOrderTime());
        		String orderFee = "¥"+orderFlight.getOrderFee().toString();
        		String orderStatusCn = orderFlight.getOrderStatusCn();
        		String peopleInfo = orderFlight.getPeopleInfo();
        		String pnrNo = orderFlight.getPnrNo();
        		String fromPort = orderFlight.getFromPort();
        		String fromPortCn = orderFlight.getFromPortCn();
        		String toPort = orderFlight.getToPort();
        		String toPortCn = orderFlight.getToPortCn();
        %>
          <tr style="border-bottom:1px solid #DDD;">
          	<td style="width:100px;"><%=airlineCn%><br/><%=flightNo%></td>
          	<td style="width:140px;"><%=fromPortCn%>(<%=fromPort%>)<br/><%=toPortCn%>(<%=toPort%>)</td>
            <td style="width:80px;"><%=flightTime.split(" ")[0]%><br/><%=flightTime.split(" ")[1]%><br/><%=arriveTime.split(" ")[1]+cr%></td>
            <td style="width:80px;"><%=orderFee%></td>
            <td style="width:100px;"><%=peopleInfo%></td>
            <td style="width:100px;"><%=pnrNo%></td>
            <td style="width:100px;"><%=orderTime%></td>
            <td style="width:100px;"><%=orderStatusCn%>&nbsp;<%if(OrderFlight.ORDER_STATUS_INIT.equals(orderFlight.getOrderStatus())){%><a href="javascript:void(0);" onclick="javascript:alert('<%=orderFlight.getId()%>');">支付</a><%}%></td>
          </tr>
        <%
        	}
        %>
          <tr>
          	<td colspan="4">
          		<%=pageInfo.getHtml()%>
          	</td>
          </tr>
        </table>
      </div>
    </div>
  </div>
  
  <jsp:include page="include/bottom.jsp" />
</div>
</body>
</html>
